package com.settlement.system.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.common.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
        import java.math.BigDecimal;
        import java.time.LocalDate;

/**
* <p>
* 月度锁账日报表
* </p>
*
* @author huangrensen
* @since 2024-08-19
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysLockDailyRecord extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
    * 账单ID
    */
    private String id;


    /**
    * 平台ID
    */
    private Long platformId;
    @TableField(exist = false)
    private String platformName;


    /**
    * 店铺ID
    */
    private Long storeId;
    @TableField(exist = false)
    private String storeName;


    /**
    * 业务日期
    */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate businessDate;


    /**
    * 发货金额
    */
    private BigDecimal sendAmount = BigDecimal.ZERO;


    /**
    * 退货金额
    */
    private BigDecimal returnAmount = BigDecimal.ZERO;


    /**
    * 应收账款余额
    */
    private BigDecimal receiveBillAmount = BigDecimal.ZERO;

    /**
     * 收入金额（发货金额-退货金额）
     */
    @TableField(exist = false)
    private BigDecimal receiveAmount = BigDecimal.ZERO;

    public void calculateReceiveAmount() {
        this.receiveAmount = this.sendAmount.subtract(this.returnAmount);
    }
}
